
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>docker安装 · 猿者荣耀</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="字维嘉">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="第一个docker版的java程序.html" />
    
    
    <link rel="prev" href="容器技术及其应用白皮书.html" />
    

    
        <link rel="shortcut icon" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="bookmark" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../source/images/apple-touch-icon.jpg'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../source/images/apple-touch-icon.jpg">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../source/images/apple-touch-icon.jpg">
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://orororz.com" target="_blank" class="custom-link">字维嘉</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    首页介绍
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">java</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="readme.html">
            
                <a href="readme.html">
            
                    
                    容器技术
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="容器技术及其应用白皮书.html">
            
                <a href="容器技术及其应用白皮书.html">
            
                    
                    容器技术及其应用白皮书
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.1.2" data-path="docker安装.html">
            
                <a href="docker安装.html">
            
                    
                    docker安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="第一个docker版的java程序.html">
            
                <a href="第一个docker版的java程序.html">
            
                    
                    第一个docker版的java程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="漫谈云计算、虚拟化、容器化.html">
            
                <a href="漫谈云计算、虚拟化、容器化.html">
            
                    
                    漫谈云计算、虚拟化、容器化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../springboot/readme.html">
            
                <a href="../springboot/readme.html">
            
                    
                    springboot
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../springboot/SpringBoot启动结构图.html">
            
                <a href="../springboot/SpringBoot启动结构图.html">
            
                    
                    SpringBoot启动结构图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../microservices/readme.html">
            
                <a href="../microservices/readme.html">
            
                    
                    微服务
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../microservices/微服务详解.html">
            
                <a href="../microservices/微服务详解.html">
            
                    
                    微服务详解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../硬件协议/readme.html">
            
                <a href="../硬件协议/readme.html">
            
                    
                    硬件协议
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../硬件协议/modbus/readme.html">
            
                <a href="../硬件协议/modbus/readme.html">
            
                    
                    modbus
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1.1" data-path="../硬件协议/modbus/modbus基本概念.html">
            
                <a href="../硬件协议/modbus/modbus基本概念.html">
            
                    
                    modbus基本概念
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../redis/readme.html">
            
                <a href="../redis/readme.html">
            
                    
                    redis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../redis/阿里云redis开发规范.html">
            
                <a href="../redis/阿里云redis开发规范.html">
            
                    
                    阿里云redis开发规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../skill/readme.html">
            
                <a href="../skill/readme.html">
            
                    
                    技巧
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../skill/java问题排查流程.html">
            
                <a href="../skill/java问题排查流程.html">
            
                    
                    java问题排查流程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">架构</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../architecture/readme.html">
            
                <a href="../architecture/readme.html">
            
                    
                    架构介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../architecture/大量设备方案.html">
            
                <a href="../architecture/大量设备方案.html">
            
                    
                    大量设备方案
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">manage</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../manage/readme.html">
            
                <a href="../manage/readme.html">
            
                    
                    管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../manage/IPD、CMMI、敏捷.html">
            
                <a href="../manage/IPD、CMMI、敏捷.html">
            
                    
                    IPD、CMMI、敏捷
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >docker安装</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#install-docker-engine-on-centos"><b></b>Install Docker Engine on CentOS</a></li><ul><li><span class="title-icon "></span><a href="#prerequisites"><b></b>Prerequisites</a></li><ul><li><span class="title-icon "></span><a href="#os-requirements"><b></b>OS requirements</a></li><li><span class="title-icon "></span><a href="#uninstall-old-versions"><b></b>Uninstall old versions</a></li></ul><li><span class="title-icon "></span><a href="#installation-methods"><b></b>Installation methods</a></li><ul><li><span class="title-icon "></span><a href="#install-using-the-repository"><b></b>Install using the repository</a></li><li><span class="title-icon "></span><a href="#install-from-a-package"><b></b>Install from a package</a></li><li><span class="title-icon "></span><a href="#install-using-the-convenience-script"><b></b>Install using the convenience script</a></li></ul><li><span class="title-icon "></span><a href="#uninstall-docker-engine"><b></b>Uninstall Docker Engine</a></li><li><span class="title-icon "></span><a href="#next-steps"><b></b>Next steps</a></li></ul></ul></div><a href="#install-docker-engine-on-centos" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><blockquote>
<p>&#x539F;&#x6587;&#x53C2;&#x89C1;&#xFF1A; <a href="https://docs.docker.com/engine/install/centos/" target="_blank">https://docs.docker.com/engine/install/centos/</a></p>
</blockquote>
<h1 id="install-docker-engine-on-centos"><a name="install-docker-engine-on-centos" class="anchor-navigation-ex-anchor" href="#install-docker-engine-on-centos"><i class="fa fa-link" aria-hidden="true"></i></a><a name="install-docker-engine-on-centos" class="plugin-anchor" href="#install-docker-engine-on-centos"><i class="fa fa-link" aria-hidden="true"></i></a>Install Docker Engine on CentOS</h1>
<p><em>Estimated reading time: 10 minutes</em></p>
<p>To get started with Docker Engine on CentOS, make sure you <a href="https://docs.docker.com/engine/install/centos/#prerequisites" target="_blank">meet the prerequisites</a>, then <a href="https://docs.docker.com/engine/install/centos/#installation-methods" target="_blank">install Docker</a>.</p>
<h2 id="prerequisites"><a name="prerequisites" class="anchor-navigation-ex-anchor" href="#prerequisites"><i class="fa fa-link" aria-hidden="true"></i></a><a name="prerequisites" class="plugin-anchor" href="#prerequisites"><i class="fa fa-link" aria-hidden="true"></i></a>Prerequisites</h2>
<h3 id="os-requirements"><a name="os-requirements" class="anchor-navigation-ex-anchor" href="#os-requirements"><i class="fa fa-link" aria-hidden="true"></i></a><a name="os-requirements" class="plugin-anchor" href="#os-requirements"><i class="fa fa-link" aria-hidden="true"></i></a>OS requirements</h3>
<p>To install Docker Engine, you need a maintained version of CentOS 7. Archived versions aren&#x2019;t supported or tested.</p>
<p>The <code>centos-extras</code> repository must be enabled. This repository is enabled by default, but if you have disabled it, you need to <a href="https://wiki.centos.org/AdditionalResources/Repositories" target="_blank">re-enable it</a>.</p>
<p>The <code>overlay2</code> storage driver is recommended.</p>
<h3 id="uninstall-old-versions"><a name="uninstall-old-versions" class="anchor-navigation-ex-anchor" href="#uninstall-old-versions"><i class="fa fa-link" aria-hidden="true"></i></a><a name="uninstall-old-versions" class="plugin-anchor" href="#uninstall-old-versions"><i class="fa fa-link" aria-hidden="true"></i></a>Uninstall old versions</h3>
<p>Older versions of Docker were called <code>docker</code> or <code>docker-engine</code>. If these are installed, uninstall them, along with associated dependencies.</p>
<pre><code>$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
</code></pre><p>It&#x2019;s OK if <code>yum</code> reports that none of these packages are installed.</p>
<p>The contents of <code>/var/lib/docker/</code>, including images, containers, volumes, and networks, are preserved. The Docker Engine package is now called <code>docker-ce</code>.</p>
<h2 id="installation-methods"><a name="installation-methods" class="anchor-navigation-ex-anchor" href="#installation-methods"><i class="fa fa-link" aria-hidden="true"></i></a><a name="installation-methods" class="plugin-anchor" href="#installation-methods"><i class="fa fa-link" aria-hidden="true"></i></a>Installation methods</h2>
<p>You can install Docker Engine in different ways, depending on your needs:</p>
<ul>
<li>Most users <a href="https://docs.docker.com/engine/install/centos/#install-using-the-repository" target="_blank">set up Docker&#x2019;s repositories</a> and install from them, for ease of installation and upgrade tasks. This is the recommended approach.</li>
<li>Some users download the RPM package and <a href="https://docs.docker.com/engine/install/centos/#install-from-a-package" target="_blank">install it manually</a> and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.</li>
<li>In testing and development environments, some users choose to use automated <a href="https://docs.docker.com/engine/install/centos/#install-using-the-convenience-script" target="_blank">convenience scripts</a> to install Docker.</li>
</ul>
<h3 id="install-using-the-repository"><a name="install-using-the-repository" class="anchor-navigation-ex-anchor" href="#install-using-the-repository"><i class="fa fa-link" aria-hidden="true"></i></a><a name="install-using-the-repository" class="plugin-anchor" href="#install-using-the-repository"><i class="fa fa-link" aria-hidden="true"></i></a>Install using the repository</h3>
<p>Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.</p>
<h4 id="set-up-the-repository"><a name="set-up-the-repository" class="anchor-navigation-ex-anchor" href="#set-up-the-repository"><i class="fa fa-link" aria-hidden="true"></i></a><a name="set-up-the-repository" class="plugin-anchor" href="#set-up-the-repository"><i class="fa fa-link" aria-hidden="true"></i></a>SET UP THE REPOSITORY</h4>
<p>Install the <code>yum-utils</code> package (which provides the <code>yum-config-manager</code> utility) and set up the <strong>stable</strong> repository.</p>
<pre><code>$ sudo yum install -y yum-utils

$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
</code></pre><blockquote>
<p><strong>Optional</strong>: Enable the <strong>nightly</strong> or <strong>test</strong> repositories.</p>
<p>These repositories are included in the <code>docker.repo</code> file above but are disabled by default. You can enable them alongside the stable repository. The following command enables the <strong>nightly</strong> repository.</p>
<pre><code>$ sudo yum-config-manager --enable docker-ce-nightly
</code></pre><p>To enable the <strong>test</strong> channel, run the following command:</p>
<pre><code>$ sudo yum-config-manager --enable docker-ce-test
</code></pre><p>You can disable the <strong>nightly</strong> or <strong>test</strong> repository by running the <code>yum-config-manager</code> command with the <code>--disable</code> flag. To re-enable it, use the <code>--enable</code> flag. The following command disables the <strong>nightly</strong> repository.</p>
<pre><code>$ sudo yum-config-manager --disable docker-ce-nightly
</code></pre><p><a href="https://docs.docker.com/engine/install/" target="_blank">Learn about <strong>nightly</strong> and <strong>test</strong> channels</a>.</p>
</blockquote>
<h4 id="install-docker-engine"><a name="install-docker-engine" class="anchor-navigation-ex-anchor" href="#install-docker-engine"><i class="fa fa-link" aria-hidden="true"></i></a><a name="install-docker-engine" class="plugin-anchor" href="#install-docker-engine"><i class="fa fa-link" aria-hidden="true"></i></a>INSTALL DOCKER ENGINE</h4>
<ol>
<li><p>Install the <em>latest version</em> of Docker Engine and containerd, or go to the next step to install a specific version:</p>
<pre><code>$ sudo yum install docker-ce docker-ce-cli containerd.io
</code></pre><p>If prompted to accept the GPG key, verify that the fingerprint matches <code>060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35</code>, and if so, accept it.</p>
<blockquote>
<p>Got multiple Docker repositories?</p>
<p>If you have multiple Docker repositories enabled, installing or updating without specifying a version in the <code>yum install</code> or <code>yum update</code> command always installs the highest possible version, which may not be appropriate for your stability needs.</p>
</blockquote>
<p>Docker is installed but not started. The <code>docker</code> group is created, but no users are added to the group.</p>
</li>
<li><p>To install a <em>specific version</em> of Docker Engine, list the available versions in the repo, then select and install:</p>
<p>a. List and sort the versions available in your repo. This example sorts results by version number, highest to lowest, and is truncated:</p>
<pre><code>$ yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64  3:18.09.1-3.el7                     docker-ce-stable
docker-ce.x86_64  3:18.09.0-3.el7                     docker-ce-stable
docker-ce.x86_64  18.06.1.ce-3.el7                    docker-ce-stable
docker-ce.x86_64  18.06.0.ce-3.el7                    docker-ce-stable
</code></pre><p>The list returned depends on which repositories are enabled, and is specific to your version of CentOS (indicated by the <code>.el7</code> suffix in this example).</p>
<p>b. Install a specific version by its fully qualified package name, which is the package name (<code>docker-ce</code>) plus the version string (2nd column) starting at the first colon (<code>:</code>), up to the first hyphen, separated by a hyphen (<code>-</code>). For example, <code>docker-ce-18.09.1</code>.</p>
<pre><code>$ sudo yum install docker-ce-&lt;VERSION_STRING&gt; docker-ce-cli-&lt;VERSION_STRING&gt; containerd.io
</code></pre><p>Docker is installed but not started. The <code>docker</code> group is created, but no users are added to the group.</p>
</li>
<li><p>Start Docker.</p>
<pre><code>$ sudo systemctl start docker
</code></pre></li>
<li><p>Verify that Docker Engine is installed correctly by running the <code>hello-world</code> image.</p>
<pre><code>$ sudo docker run hello-world
</code></pre><p>This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.</p>
</li>
</ol>
<p>Docker Engine is installed and running. You need to use <code>sudo</code> to run Docker commands. Continue to <a href="https://docs.docker.com/engine/install/linux-postinstall/" target="_blank">Linux postinstall</a> to allow non-privileged users to run Docker commands and for other optional configuration steps.</p>
<h4 id="upgrade-docker-engine"><a name="upgrade-docker-engine" class="anchor-navigation-ex-anchor" href="#upgrade-docker-engine"><i class="fa fa-link" aria-hidden="true"></i></a><a name="upgrade-docker-engine" class="plugin-anchor" href="#upgrade-docker-engine"><i class="fa fa-link" aria-hidden="true"></i></a>UPGRADE DOCKER ENGINE</h4>
<p>To upgrade Docker Engine, follow the <a href="https://docs.docker.com/engine/install/centos/#install-using-the-repository" target="_blank">installation instructions</a>, choosing the new version you want to install.</p>
<h3 id="install-from-a-package"><a name="install-from-a-package" class="anchor-navigation-ex-anchor" href="#install-from-a-package"><i class="fa fa-link" aria-hidden="true"></i></a><a name="install-from-a-package" class="plugin-anchor" href="#install-from-a-package"><i class="fa fa-link" aria-hidden="true"></i></a>Install from a package</h3>
<p>If you cannot use Docker&#x2019;s repository to install Docker, you can download the <code>.rpm</code> file for your release and install it manually. You need to download a new file each time you want to upgrade Docker Engine.</p>
<ol>
<li><p>Go to <a href="https://download.docker.com/linux/centos/" target="_blank">https://download.docker.com/linux/centos/</a> and choose your version of CentOS. Then browse to <code>x86_64/stable/Packages/</code> and download the <code>.rpm</code> file for the Docker version you want to install.</p>
<blockquote>
<p><strong>Note</strong>: To install a <strong>nightly</strong> or <strong>test</strong> (pre-release) package, change the word <code>stable</code> in the above URL to <code>nightly</code> or <code>test</code>. <a href="https://docs.docker.com/engine/install/" target="_blank">Learn about <strong>nightly</strong> and <strong>test</strong> channels</a>.</p>
</blockquote>
</li>
<li><p>Install Docker Engine, changing the path below to the path where you downloaded the Docker package.</p>
<pre><code>$ sudo yum install /path/to/package.rpm
</code></pre><p>Docker is installed but not started. The <code>docker</code> group is created, but no users are added to the group.</p>
</li>
<li><p>Start Docker.</p>
<pre><code>$ sudo systemctl start docker
</code></pre></li>
<li><p>Verify that Docker Engine is installed correctly by running the <code>hello-world</code> image.</p>
<pre><code>$ sudo docker run hello-world
</code></pre><p>This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.</p>
</li>
</ol>
<p>Docker Engine is installed and running. You need to use <code>sudo</code> to run Docker commands. Continue to <a href="https://docs.docker.com/engine/install/linux-postinstall/" target="_blank">Post-installation steps for Linux</a> to allow non-privileged users to run Docker commands and for other optional configuration steps.</p>
<h4 id="upgrade-docker-engine_1"><a name="upgrade-docker-engine_1" class="anchor-navigation-ex-anchor" href="#upgrade-docker-engine_1"><i class="fa fa-link" aria-hidden="true"></i></a><a name="upgrade-docker-engine" class="plugin-anchor" href="#upgrade-docker-engine"><i class="fa fa-link" aria-hidden="true"></i></a>UPGRADE DOCKER ENGINE</h4>
<p>To upgrade Docker Engine, download the newer package file and repeat the <a href="https://docs.docker.com/engine/install/centos/#install-from-a-package" target="_blank">installation procedure</a>, using <code>yum -y upgrade</code> instead of <code>yum -y install</code>, and pointing to the new file.</p>
<h3 id="install-using-the-convenience-script"><a name="install-using-the-convenience-script" class="anchor-navigation-ex-anchor" href="#install-using-the-convenience-script"><i class="fa fa-link" aria-hidden="true"></i></a><a name="install-using-the-convenience-script" class="plugin-anchor" href="#install-using-the-convenience-script"><i class="fa fa-link" aria-hidden="true"></i></a>Install using the convenience script</h3>
<p>Docker provides convenience scripts at <a href="https://get.docker.com/" target="_blank">get.docker.com</a> and <a href="https://test.docker.com/" target="_blank">test.docker.com</a> for installing edge and testing versions of Docker Engine - Community into development environments quickly and non-interactively. The source code for the scripts is in the <a href="https://github.com/docker/docker-install" target="_blank"><code>docker-install</code> repository</a>. <strong>Using these scripts is not recommended for production environments</strong>, and you should understand the potential risks before you use them:</p>
<ul>
<li>The scripts require <code>root</code> or <code>sudo</code> privileges to run. Therefore, you should carefully examine and audit the scripts before running them.</li>
<li>The scripts attempt to detect your Linux distribution and version and configure your package management system for you. In addition, the scripts do not allow you to customize any installation parameters. This may lead to an unsupported configuration, either from Docker&#x2019;s point of view or from your own organization&#x2019;s guidelines and standards.</li>
<li>The scripts install all dependencies and recommendations of the package manager without asking for confirmation. This may install a large number of packages, depending on the current configuration of your host machine.</li>
<li>The script does not provide options to specify which version of Docker to install, and installs the latest version that is released in the &#x201C;edge&#x201D; channel.</li>
<li>Do not use the convenience script if Docker has already been installed on the host machine using another mechanism.</li>
</ul>
<p>This example uses the script at <a href="https://get.docker.com/" target="_blank">get.docker.com</a> to install the latest release of Docker Engine - Community on Linux. To install the latest testing version, use <a href="https://test.docker.com/" target="_blank">test.docker.com</a> instead. In each of the commands below, replace each occurrence of <code>get</code> with <code>test</code>.</p>
<blockquote>
<p><strong>Warning</strong>:</p>
<p>Always examine scripts downloaded from the internet before running them locally.</p>
</blockquote>
<pre><code>$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

&lt;output truncated&gt;
</code></pre><p>If you would like to use Docker as a non-root user, you should now consider adding your user to the &#x201C;docker&#x201D; group with something like:</p>
<pre><code>  sudo usermod -aG docker your-user
</code></pre><p>Remember to log out and back in for this to take effect!</p>
<blockquote>
<p><strong>Warning</strong>:</p>
<p>Adding a user to the &#x201C;docker&#x201D; group grants them the ability to run containers which can be used to obtain root privileges on the Docker host. Refer to <a href="https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface" target="_blank">Docker Daemon Attack Surface</a> for more information.</p>
</blockquote>
<p>Docker Engine - Community is installed. It starts automatically on <code>DEB</code>-based distributions. On <code>RPM</code>-based distributions, you need to start it manually using the appropriate <code>systemctl</code> or <code>service</code> command. As the message indicates, non-root users can&#x2019;t run Docker commands by default.</p>
<blockquote>
<p><strong>Note</strong>:</p>
<p>To install Docker without root privileges, see <a href="https://docs.docker.com/engine/security/rootless/" target="_blank">Run the Docker daemon as a non-root user (Rootless mode)</a>.</p>
<p>Rootless mode is currently available as an experimental feature.</p>
</blockquote>
<h4 id="upgrade-docker-after-using-the-convenience-script"><a name="upgrade-docker-after-using-the-convenience-script" class="anchor-navigation-ex-anchor" href="#upgrade-docker-after-using-the-convenience-script"><i class="fa fa-link" aria-hidden="true"></i></a><a name="upgrade-docker-after-using-the-convenience-script" class="plugin-anchor" href="#upgrade-docker-after-using-the-convenience-script"><i class="fa fa-link" aria-hidden="true"></i></a>UPGRADE DOCKER AFTER USING THE CONVENIENCE SCRIPT</h4>
<p>If you installed Docker using the convenience script, you should upgrade Docker using your package manager directly. There is no advantage to re-running the convenience script, and it can cause issues if it attempts to re-add repositories which have already been added to the host machine.</p>
<h2 id="uninstall-docker-engine"><a name="uninstall-docker-engine" class="anchor-navigation-ex-anchor" href="#uninstall-docker-engine"><i class="fa fa-link" aria-hidden="true"></i></a><a name="uninstall-docker-engine" class="plugin-anchor" href="#uninstall-docker-engine"><i class="fa fa-link" aria-hidden="true"></i></a>Uninstall Docker Engine</h2>
<ol>
<li><p>Uninstall the Docker Engine, CLI, and Containerd packages:</p>
<pre><code>$ sudo yum remove docker-ce docker-ce-cli containerd.io
</code></pre></li>
<li><p>Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:</p>
<pre><code>$ sudo rm -rf /var/lib/docker
</code></pre></li>
</ol>
<p>You must delete any edited configuration files manually.</p>
<h2 id="next-steps"><a name="next-steps" class="anchor-navigation-ex-anchor" href="#next-steps"><i class="fa fa-link" aria-hidden="true"></i></a><a name="next-steps" class="plugin-anchor" href="#next-steps"><i class="fa fa-link" aria-hidden="true"></i></a>Next steps</h2>
<ul>
<li>Continue to <a href="https://docs.docker.com/engine/install/linux-postinstall/" target="_blank">Post-installation steps for Linux</a>.</li>
<li>Review the topics in <a href="https://docs.docker.com/develop/" target="_blank">Develop with Docker</a> to learn how to build new applications using Docker.</li>
</ul>
<p><a href="https://docs.docker.com/search/?q=requirements" target="_blank">requirements</a>, <a href="https://docs.docker.com/search/?q=apt" target="_blank">apt</a>, <a href="https://docs.docker.com/search/?q=installation" target="_blank">installation</a>, <a href="https://docs.docker.com/search/?q=centos" target="_blank">centos</a>, <a href="https://docs.docker.com/search/?q=rpm" target="_blank">rpm</a>, <a href="https://docs.docker.com/search/?q=install" target="_blank">install</a>, <a href="https://docs.docker.com/search/?q=uninstall" target="_blank">uninstall</a>, <a href="https://docs.docker.com/search/?q=upgrade" target="_blank">upgrade</a>, <a href="https://docs.docker.com/search/?q=update" target="_blank">update</a></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="容器技术及其应用白皮书.html" class="navigation navigation-prev " aria-label="Previous page: 容器技术及其应用白皮书">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="第一个docker版的java程序.html" class="navigation navigation-next " aria-label="Next page: 第一个docker版的java程序">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"docker安装","level":"2.1.2","depth":2,"next":{"title":"第一个docker版的java程序","level":"2.1.3","depth":2,"path":"容器技术/第一个docker版的java程序.md","ref":"容器技术/第一个docker版的java程序.md","articles":[]},"previous":{"title":"容器技术及其应用白皮书","level":"2.1.1","depth":2,"path":"容器技术/容器技术及其应用白皮书.md","ref":"容器技术/容器技术及其应用白皮书.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-back-to-top-button","-lunr","-search","search-pro","chapter-fold","splitter","-expandable-chapters-small","expandable-chapters","anchors","github","-github-buttons","code","anchor-navigation-ex","favicon","advanced-emoji","-sharing","-sharing-plus","-page-copyright","hide-element"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"chapter-fold":{},"github":{"url":"https://github.com/nullllun"},"splitter":{},"search-pro":{},"page-copyright":{"wisdom":"technology and management，software and hardware","noPowered":false,"copyright":"Copyright &#169; 字维嘉","style":"normal","timeColor":"#666","utcOffset":"8","format":"YYYY-MM-dd hh:mm:ss","signature":"yzry","copyrightColor":"#666","description":"modified at"},"code":{"copyButtons":true},"donate":{"alipay":"./source/images/donate.png","title":"","button":"赞赏","alipayText":" "},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./source/images/favicon.jpg","bookmark":"./source/images/favicon.jpg","appleTouch":"./source/images/apple-touch-icon.jpg","appleTouchMore":{"120x120":"./source/images/apple-touch-icon.jpg","180x180":"./source/images/apple-touch-icon.jpg"}},"github-buttons":{"buttons":[{"user":"nullllun","repo":"glory","type":"star","size":"small","count":true}]},"advanced-emoji":{"embedEmojis":false},"sharing":{"qq":false,"all":["google","facebook","weibo","twitter","qq","qzone","linkedin","pocket"],"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"expandable-chapters":{}},"theme":"default","author":"字维嘉","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"猿者荣耀","language":"zh-hans","links":{"sidebar":{"字维嘉":"http://orororz.com"}},"gitbook":"3.2.3","description":"金鳞岂是池中物"},"file":{"path":"容器技术/docker安装.md","mtime":"2020-05-08T02:09:01.247Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-21T09:00:35.532Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

